Skip to content

[uraflower] Week 15 Solutions #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 12, 2025
Merged

[uraflower] Week 15 Solutions #1663

merged 6 commits into from
Jul 12, 2025

Conversation

uraflower
Copy link
Contributor

@uraflower uraflower commented Jul 8, 2025

답안 제출 문제

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@uraflower uraflower moved this from Solving to In Review in 리트코드 스터디 4기 Jul 12, 2025
Copy link
Contributor

@seungriyou seungriyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전반적으로 작성하신 코드가 주석이 따로 필요 없을만큼 가독성이 좋고 깔끔하네요! 비록 사용하는 언어는 다르지만 정말 많이 배우고 갑니다 😄

15주의 긴 기간동안 정말 고생 많으셨어요! 이번 스터디를 통해 얻으신 것들을 기반으로 앞으로 희망하시는 커리어를 차곡차곡 쌓아나가시길 응원하겠습니다~! 🚀

let found = false;

const minLen = Math.min(prev.length, current.length);
for (let j = 0; j < minLen; j++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minLen 내 인덱스 범위에서 prevcurrent 간 문자쌍 중 처음으로 서로 다른 문자까지만 graph에 추가해야 할 것 같은데요(그 이후 문자는 더이상 비교할 수 없기 때문), 현재 코드에서는 minLen까지 모든 범위에 대해 graph를 구성하고 있는 것 같아요!

그리고 현재 코드에서는 found 변수를 true로 바꾸는 코드가 없어서 항상 false 인 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 제가 무료 버전에서 풀다가 실행시키려고 다른 편집기에서 작성했는데 그래서 풀다 만 버전으로 잘못 올렸네요.
꼼꼼히 봐주시고 말씀해주셔서 정말 감사합니다! 😄

}
visiting.delete(current);

visited.add(current);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 이 문제를 위상정렬(BFS)로 풀었는데요, DFS로 풀려면 indegree를 기록할 필요 없이 이렇게 상태를 하나 더 유지해서 풀 수 있군요! visitingvisited라는 네이밍이 직관적이어서 이해하기 쉬웠습니다 🤩

queue.push(node.right);
}

if (isSame(node, subRoot)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BFS로 root 트리를 순회하는 동작과 재귀적으로 subRoot 트리와 비교하는 동작을 정말 깔끔하게 구현하신 것 같아요!

@uraflower uraflower merged commit 604f33a into DaleStudy:main Jul 12, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 4기 Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants